package il.ac.braude.sona.gui.forms.myforms;

import il.ac.braude.sona.constants.ButtonPermission;
import il.ac.braude.sona.constants.Resources;
import il.ac.braude.sona.entities.ChangeRequest;
import il.ac.braude.sona.gui.forms.FormFrame;
import il.ac.braude.sona.gui.forms.FormPanel;
import il.ac.braude.sona.gui.forms.questions.QComboBox;

import java.util.ArrayList;
/**
 * The AppointWorkersToStagesForm is a FormFrame that create the GUI for the appoint workers to stages
 *  
 * @author Ofek Ron
 * @author Avihay Avitan
 * @author Nitzan Inbar
 * @author Sasha Rozenthal
 */
public class AppointWorkersToStagesForm extends FormFrame {
	/**
	 * the id of the request that needs to appoint stage to
	 */
	private String reqid;
	
	/**
	 * Creates the GUI for appoint workers to request window
	 * @param workers - all workers in system
	 * @param req - the relevant request
	 * @param surveyor - the system-auto surveyor appointed
	 */
	public AppointWorkersToStagesForm(ArrayList<String> workers, ChangeRequest req,String surveyor) {
		super(ButtonPermission.AppointWorkersToReq, Resources.Strings.OK);
		FormPanel form = new FormPanel();
		setReqid(req.getID());
		form.addTitleWithUnderline("Appoint workers for request id: "+getReqid());
		form.addQuestion(new QComboBox("Surveyor:",workers.toArray(new String[workers.size()]),workers.indexOf(surveyor)));
		form.addQuestion(new QComboBox("Execution leader:",workers.toArray(new String[workers.size()])));
		setFormPanel(form);
	}
	/**
	 * Creates the GUI for appoint tester to request window
	 * @param workers - all workers in system
	 * @param reqid - the relevant request
	 * @param tester - all workers that can be tester (board members)
	 */
	public AppointWorkersToStagesForm(String[] workers, String reqid,String tester) {
		super(ButtonPermission.AppointTester, Resources.Strings.OK);
		FormPanel form = new FormPanel();
		setReqid(reqid);
		form.addTitleWithUnderline("Appoint Tester for request id: "+getReqid());
		form.addQuestion(new QComboBox("Tester:",workers));
		setFormPanel(form);
	}
	/**
	 * Returns the reqid
	 * @return reqid
	 */
	public String getReqid() {
		return reqid;
	}
	/**
	 * Sets the reqid
	 * @param reqid - the reqid to set
	 */
	public void setReqid(String reqid) {
		this.reqid = reqid;
	}
	
	

}
